<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>layui.form小例子</title>
<link rel="stylesheet" href="./css/layui.css" media="all">
<script type="text/javascript" src="jquery-2.1.4.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body style="background: url(img/a.gif) no-repeat; background-size: cover;">

	<div style="width:95%;margin: 150px auto">

	<form class="layui-form" action="PhoneLoginServlet" method="post">
		<input id="uuid" name="uuid" type="hidden">
					<!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
					<div class="layui-form-item">
						<label class="layui-form-label">输入框</label>
						<div class="layui-input-block">
							<input type="text" name="phoneName" placeholder="请输入用户名" autocomplete="off"
								class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">输入框</label>
						<div class="layui-input-block">
							<input type="password" name="phonePwd" placeholder="请输入密码" autocomplete="off"
								class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-input-block">
							<button class="layui-btn" lay-submit lay-filter="formDemo">登录</button>
							<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						</div>
					</div>
				</form>
</div>
	<script src="layui.js"></script>
	<script>
		layui.use([ 'form', 'element' ], function() {
			var form = layui.form;
			var element = layui.element;
			var $ = layui.jquery;
			$("#uuid").val(getUrlParam("uuid"));
			var userInfo = localStorage.getItem("userInfo");
			alert(userInfo);
			if(localStorage.getItem("userInfo")){
				location.href="PhoneLoginServlet?userInfo="+userInfo+"&uuid="+getUrlParam("uuid");
			}

			//各种基于事件的操作，下面会有进一步介绍
		});
		
		function getUrlParam(name){
			     var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");//构造一个含有目标参数的正则表达式对象
			     var r = window.location.search.substr(1).match(reg);//匹配目标参数
			     if (r != null) return unescape(r[2]); return null;//返回参数值
		}
	</script>
</body>
</html>